//GDHS
clear
clear matrix
clear mata
cap log close
************************************************************************************
* DIRECTORY ROADMAP
sysdir set PLUS C:\ado\plus\c
************************************************************************************
global dir1 C:\Users\hab55\Dropbox\Second_paper_Ghana\2023_EDCC_Price\Data
global dir2 C:\Users\hab55\Dropbox\Second_paper_Ghana\2023_EDCC_Price\Do
global dir3 C:\Users\hab55\Dropbox\Second_paper_Ghana\2023_EDCC_Price\Output

/////////////////////////////////////////////////////////////////////////////

use  "$dir1\mother_weight.dta", clear 

global control1 " urban Age_mother mom_educ  ga_adangbe ewe guan mole others muslim traditional noreligion_other "


///////////////////////////////
////Table C.8:

areg mom_weight shock  $control1 i.region#c.year i.region   [aw=wgt], ab ( year) cluster (region)
boottest shock=0 ,  nograph  seed(321448699) 

outreg2 using "$dir3\mom_health.tex", keep(shock ) stats(coef se) bdec(3) sdec(3) nocons  label addtext(ROB FE, Yes, YOB FE, Yes, ROB Trends, Yes)

areg BMI shock  $control1 i.region#c.year i.region [aw=wgt], ab (year) cluster (region)
boottest shock=0 ,  nograph  seed(321448699) 

outreg2 using "$dir3\mom_health.tex", keep(shock ) stats(coef se) bdec(3) sdec(3) nocons  label addtext(ROB FE, Yes, YOB FE, Yes, ROB Trends, Yes)
***************************************************************************
///////////////////////////////////////////////////////////////////////////
///Mortality selection using DHS

//Table D.6 (Column 1)
use  "$dir1\miscarriage_1998_2008_full.dta", clear

global control_mort1 "mother_years_education Age_mother  no_births hub_self_agri urban akan ga_adangbe ewe guan mole muslim christian traditional"
////miscarriage
areg inutero_death shock_1 $control_mort1 i.region#c.YOB i.region i.year [aw=wgt], ab (YOB  ) cluster (region)
boottest shock_1=0 ,  nograph  seed(321448699) 

outreg2 using "$dir3\mselection.tex", keep(shock_1 ) stats(coef se) bdec(3) sdec(3) nocons  label addtext(ROB FE, Yes, YOB FE, Yes, ROB Trends, Yes, Controls, Yes)
************************************
//////////////////////////////////////////////////////////////////////
///Table D.6 (Column 2, and 3)

use  "$dir1\mortality_1988_2008_full.dta", clear

global control_mort1 "mother_years_education Age_mother no_births hub_self_agri urban akan ga_adangbe ewe guan mole muslim christian traditional"

////boy birth 
areg boy_birth shock_1 $control_mort1 i.region#c.YOB i.region i.year [aw=wgt], ab (YOB ) cluster (region)
boottest shock_1=0 ,  nograph  seed(321448699) 

outreg2 using "$dir3\mselection.tex", keep(shock_1 ) stats(coef se) bdec(3) sdec(3) nocons  label addtext(ROB FE, Yes, YOB FE, Yes, ROB Trends, Yes, Controls, Yes)
////Neonatal death
areg neonatal shock_1 $control_mort1 i.region#c.YOB i.region i.year [aw=wgt], ab (YOB  ) cluster (region)
boottest shock_1=0 ,  nograph  seed(321448699) 

outreg2 using "$dir3\mselection.tex", keep(shock_1 ) stats(coef se) bdec(3) sdec(3) nocons  label addtext(ROB FE, Yes, YOB FE, Yes, ROB Trends, Yes, Controls, Yes)

//////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////
///Table D.6 (Column 4, 5, 6, 7 and 8)
///fertility selection 
use  "$dir1\mortality_1988_2008_full.dta", clear

areg mother_years_education shock_1  i.region  i.year [aw=wgt] , ab (YOB   ) cluster (region)
boottest shock_1=0 ,  nograph  seed(321448699) 

outreg2 using "$dir3\fselection.tex", keep(shock_1 ) stats(coef se) bdec(3) sdec(3) nocons  label addtext(ROB FE, Yes, YOB FE, Yes, ROB Trends, Yes, Controls, Yes)

areg Age_mother shock_1 i.region  i.year [aw=wgt], ab (YOB) cluster (region)
boottest shock_1=0 ,  nograph  seed(321448699) 

outreg2 using "$dir3\fselection.tex", keep(shock_1 ) stats(coef se) bdec(3) sdec(3) nocons  label addtext(ROB FE, Yes, YOB FE, Yes, ROB Trends, Yes, Controls, Yes)

areg mother_height  shock_1  i.region i.year [aw=wgt], ab (YOB  ) cluster (region)
boottest shock_1=0 ,  nograph  seed(321448699) 

outreg2 using "$dir3\fselection.tex", keep(shock_1 ) stats(coef se) bdec(3) sdec(3) nocons  label addtext(ROB FE, Yes, YOB FE, Yes, ROB Trends, Yes, Controls, Yes)

areg no_births shock_1 i.region  i.year [aw=wgt], ab (YOB  ) cluster (region)
boottest shock_1=0 ,  nograph  seed(321448699) 

outreg2 using "$dir3\fselection.tex", keep(shock_1 ) stats(coef se) bdec(3) sdec(3) nocons  label addtext(ROB FE, Yes, YOB FE, Yes, ROB Trends, Yes, Controls, Yes)

areg hub_self_agri shock_1 i.region i.year [aw=wgt], ab (YOB  ) cluster (region)
boottest shock_1=0 ,  nograph  seed(321448699) 

outreg2 using "$dir3\fselection.tex", keep(shock_1 ) stats(coef se) bdec(3) sdec(3) nocons  label addtext(ROB FE, Yes, YOB FE, Yes, ROB Trends, Yes, Controls, Yes)
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////
///early life investment
//Table C.9:
use "$dir1\investment_1988_2008_full.dta", clear 

global control "Age_mother mother_years_education Household_size bord  age gender rural akan ga_adangbe ewe guan mole christian  muslim traditional"

 ///////////////////////////////////////////////////////////////////////////////////
 ////Panal A: birth investment
 areg formal_prenatalcare shock_1 $control i.region#c.YOB i.region i.year i.age  [aw=wgt] , ab (YOB) cluster (region)
 boottest shock_1=0 ,  nograph  seed(321448699) 

 outreg2 using "$dir3\investment3.tex", keep(shock_1 ) stats(coef se) bdec(3) sdec(3) nocons  label addtext(ROB FE, Yes, YOB FE, Yes, ROB Trends, Yes, Survey Year FE, Yes, Controls, Yes)

 areg formal_delivery shock_1 $control i.region#c.YOB i.region i.year i.age  [aw=wgt] , ab (YOB) cluster (region)
 boottest shock_1=0 ,  nograph  seed(321448699) 

 outreg2 using "$dir3\investment3.tex", keep(shock_1 ) stats(coef se) bdec(3) sdec(3) nocons  label addtext(ROB FE, Yes, YOB FE, Yes, ROB Trends, Yes, Survey Year FE, Yes, Controls, Yes)

 areg BCG shock_1 $control i.region#c.YOB i.region i.year i.age  [aw=wgt] , ab (YOB) cluster (region)
 boottest shock_1=0 ,  nograph  seed(321448699) 

 outreg2 using "$dir3\investment3.tex", keep(shock_1 ) stats(coef se) bdec(3) sdec(3) nocons  label addtext(ROB FE, Yes, YOB FE, Yes, ROB Trends, Yes, Survey Year FE, Yes, Controls, Yes)

 areg polio0 shock_1 $control i.region#c.YOB i.region i.year i.age  [aw=wgt] , ab (YOB) cluster (region)
 boottest shock_1=0 ,  nograph  seed(321448699) 

 outreg2 using "$dir3\investment3.tex", keep(shock_1 ) stats(coef se) bdec(3) sdec(3) nocons  label addtext(ROB FE, Yes, YOB FE, Yes, ROB Trends, Yes, Survey Year FE, Yes, Controls, Yes)
///////////////////////////////////////////////////////////////////////////////
 ///Panal B: childhood investment
areg No_polio shock_1 $control i.region#c.YOB i.region i.year i.age [aw=wgt] , ab (YOB) cluster (region)
boottest shock_1=0 ,  nograph  seed(321448699) 

outreg2 using "$dir3\investment1.tex", keep(shock_1 ) stats(coef se) bdec(3) sdec(3) nocons  label addtext(ROB FE, Yes, YOB FE, Yes, ROB Trends, Yes, Survey Year FE, Yes, Controls, Yes)

areg No_DPT shock_1  $control i.region#c.YOB i.region i.year i.age  [aw=wgt] , ab (YOB) cluster (region)
boottest shock_1=0 ,  nograph  seed(321448699) 

outreg2 using "$dir3\investment1.tex", keep(shock_1 ) stats(coef se) bdec(3) sdec(3) nocons  label addtext(ROB FE, Yes, YOB FE, Yes, ROB Trends, Yes, Survey Year FE, Yes, Controls, Yes)

areg Measles shock_1 $control i.region#c.YOB i.region i.year i.age  [aw=wgt] , ab (YOB) cluster (region)
boottest shock_1=0 ,  nograph  seed(321448699) 

outreg2 using "$dir3\investment1.tex", keep(shock_1 ) stats(coef se) bdec(3) sdec(3) nocons  label addtext(ROB FE, Yes, YOB FE, Yes, ROB Trends, Yes, Survey Year FE, Yes, Controls, Yes)

areg Total_vaccin shock_1  $control i.region#c.YOB i.region i.year i.age  [aw=wgt] , ab (YOB) cluster (region)
boottest shock_1=0 ,  nograph  seed(321448699) 

outreg2 using "$dir3\investment1.tex", keep(shock_1 ) stats(coef se) bdec(3) sdec(3) nocons  label addtext(ROB FE, Yes, YOB FE, Yes, ROB Trends, Yes, Survey Year FE, Yes, Controls, Yes)

areg Months_breastfeeding shock_1 $control i.region#c.YOB i.region i.year i.age  [aw=wgt] , ab (YOB) cluster (region)
boottest shock_1=0 ,  nograph  seed(321448699) 

outreg2 using "$dir3\investment1.tex", keep(shock_1 ) stats(coef se) bdec(3) sdec(3) nocons  label addtext(ROB FE, Yes, YOB FE, Yes, ROB Trends, Yes, Survey Year FE, Yes, Controls, Yes)

 ///////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////
///excluding 2008 dhs
///Table C.10: 
drop if year>2004

////Panal A: birth investment
areg formal_prenatalcare shock_1 $control  i.region#c.YOB i.region i.year i.age [aw=wgt] , ab (YOB ) cluster (region)
 boottest shock_1=0 ,  nograph  seed(321448699) 

outreg2 using "$dir3\investment_pre_2008.tex", keep(shock_1 ) stats(coef se) bdec(3) sdec(3) nocons  label addtext(ROB FE, Yes, YOB FE, Yes, ROB Trends, Yes, Survey Year FE, Yes, Controls, Yes)

areg formal_delivery shock_1 $control  i.region#c.YOB i.region i.year i.age [aw=wgt] , ab (YOB  ) cluster (region)
 boottest shock_1=0 ,  nograph  seed(321448699) 

outreg2 using "$dir3\investment_pre_2008.tex", keep(shock_1 ) stats(coef se) bdec(3) sdec(3) nocons  label addtext(ROB FE, Yes, YOB FE, Yes, ROB Trends, Yes, Survey Year FE, Yes, Controls, Yes)

areg BCG shock_1 $control  i.region#c.YOB i.region i.year i.age [aw=wgt] , ab (YOB  ) cluster (region)
 boottest shock_1=0 ,  nograph  seed(321448699) 

outreg2 using "$dir3\investment_pre_2008.tex", keep(shock_1 ) stats(coef se) bdec(3) sdec(3) nocons  label addtext(ROB FE, Yes, YOB FE, Yes, ROB Trends, Yes, Survey Year FE, Yes, Controls, Yes)

areg polio0 shock_1 $control  i.region#c.YOB i.region i.year i.age [aw=wgt] , ab (YOB  ) cluster (region)
 boottest shock_1=0 ,  nograph  seed(321448699) 

outreg2 using "$dir3\investment_pre_2008.tex", keep(shock_1 ) stats(coef se) bdec(3) sdec(3) nocons  label addtext(ROB FE, Yes, YOB FE, Yes, ROB Trends, Yes, Survey Year FE, Yes, Controls, Yes)
//////////////////////////////////////////////////////////////////////////////

 ////Panel B: childhood investment
areg No_polio shock_1 $control i.region#c.YOB i.region i.year i.age [aw=wgt] , ab (YOB   ) cluster (region)
 boottest shock_1=0 ,  nograph  seed(321448699) 

outreg2 using "$dir3\investment_2008.tex", keep(shock_1 ) stats(coef se) bdec(3) sdec(3) nocons  label addtext(ROB FE, Yes, YOB FE, Yes, ROB Trends, Yes, Survey Year FE, Yes, Controls, Yes)
areg No_DPT shock_1  $control i.region#c.YOB i.region i.year i.age [aw=wgt] , ab (YOB  ) cluster (region)
 boottest shock_1=0 ,  nograph  seed(321448699) 

outreg2 using "$dir3\investment_2008.tex", keep(shock_1 ) stats(coef se) bdec(3) sdec(3) nocons  label addtext(ROB FE, Yes, YOB FE, Yes, ROB Trends, Yes, Survey Year FE, Yes, Controls, Yes)

areg Measles shock_1 $control i.region#c.YOB i.region i.year i.age [aw=wgt] , ab (YOB  ) cluster (region)
 boottest shock_1=0 ,  nograph  seed(321448699) 

outreg2 using "$dir3\investment_2008.tex", keep(shock_1 ) stats(coef se) bdec(3) sdec(3) nocons  label addtext(ROB FE, Yes, YOB FE, Yes, ROB Trends, Yes, Survey Year FE, Yes, Controls, Yes)

areg Total_vaccin shock_1  $control i.region#c.YOB i.region i.year i.age [aw=wgt] , ab (YOB  ) cluster (region)
 boottest shock_1=0 ,  nograph  seed(321448699) 

outreg2 using "$dir3\investment_2008.tex", keep(shock_1 ) stats(coef se) bdec(3) sdec(3) nocons  label addtext(ROB FE, Yes, YOB FE, Yes, ROB Trends, Yes, Survey Year FE, Yes, Controls, Yes)

areg Months_breastfeeding shock_1 $control i.region#c.YOB i.region i.year i.age [aw=wgt] , ab (YOB ) cluster (region)
 boottest shock_1=0 ,  nograph  seed(321448699) 

outreg2 using "$dir3\investment_2008.tex", keep(shock_1 ) stats(coef se) bdec(3) sdec(3) nocons  label addtext(ROB FE, Yes, YOB FE, Yes, ROB Trends, Yes, Survey Year FE, Yes, Controls, Yes)
///////////////////////////////////////////////////////////////////////////////
 ////
 
//////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////